using System.ComponentModel;
using Comteck.Winforms.Properties;
using DevExpress.XtraEditors;

namespace Comteck.Winforms.Controls {
  /// <summary>
  /// 
  /// </summary>
  [ToolboxItem(true)]
  public partial class MyLabel : LabelControl{
    /// <summary>
    /// 
    /// </summary>
    public MyLabel() : base() {
      this.ShowCustomImage(_ShowInfoImage);
    }

    /// <summary>
    /// 初始化，默认添加一个图片
    /// </summary>
    /// <param name="isShow"></param>
    private void ShowCustomImage(bool isShow = false) {
      if (isShow) {
        //this.Appearance.Image = Resources.info_16x16;
        this.Appearance.Options.UseImage = true;
      } else {
        this.Appearance.Image = null;
        this.Appearance.Options.UseImage = false;
      }
      this.ImageAlignToText = ImageAlignToText.RightCenter;
    }

    private bool _ShowInfoImage = false;

    /// <summary>
    /// 是否显示图片
    /// </summary>
    [DefaultValue(false), Category("功能扩展"),Description("是否显示图片"), Browsable(true)]
    public virtual bool ShowInfoImage {
      get { return _ShowInfoImage; }
      set {
        _ShowInfoImage = value;
        this.ShowCustomImage(_ShowInfoImage);
      }
    }

  }
}
